/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package events.pose;

import gui.SnazzySpritesGUI;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import snazzysprites.SnazzySprites;
import state.SnazzySpritesStateManager;

/**
 * Handles shifting the current pose's sequence in the current animation, one frame forward.
 * @author Andrew Gratta <andrew.gratta@stonybrook.edu>
 */
public class ShiftPoseRightHandler implements ActionListener {

    @Override
    public void actionPerformed(ActionEvent e) {
        SnazzySprites singleton = SnazzySprites.getSnazzySprites();
        SnazzySpritesStateManager manager = singleton.getStateManager();
        SnazzySpritesGUI gui = singleton.getGUI();
        int index = gui.getSelectedPoseIndex();
        if (index >= manager.getAnimation().getPoseCount())
        {
            return;
        }
        manager.getAnimation().shiftPoseRight(index);
        gui.setSelectedPoseIndex(index + 1);
        manager.markSpriteTypeChanged();
    }
    
}
